<?php
    $host           ="localhost";
    $username       ="root";
    $password       ="123456";
    $database       ="db_librarysystem";
    
    $connection     = mysql_connect($host,$username,$password) or die ("DB Connection Error");

    mysql_select_db($database,$connection) or die ("DB Connection Error");
    
    $employeeNo     = $_POST['employeeNo'];
    $fName          = $_POST['fName'];
    $lName          = $_POST['lName'];
    $mName          = $_POST['mName'];
    $address        = $_POST['address'];
    $contactNumber  = $_POST['contactNumber'];
    $birthDate      = $_POST['bdatemonth']."-".$_POST['bdateday']."-".$_POST['year'];
    $gender         = $_POST['gender'];
    $department     = $_POST['department'];
    $password1      = $_POST['password1'];
    $password2      = $_POST['password2'];

    $sql            = "INSERT INTO tbl_facreg(
                                            employeeNo,
                                            fName,
                                            lName,
                                            mName,
                                            address,
                                            contactNumber,
                                            birthDate,
                                            gender,
                                            department,
                                            password1,
                                            password2)
                        VALUES (
                                '{$employeeNo}',
                                '{$fName}',
                                '{$lName}',
                                '{$mName}',
                                '{$address}',
                                '{$contactNumber}',
                                '{$birthDate}',
                                '{$gender}',
                                '{$department}',
                                '{$password1}',
                                '{$password2}')";

        if ($_POST ['password1'] != $_POST['password2'])
        {
            echo "Password did not match!";
        }
        
        else
        
        {
            mysql_query($sql, $connection) or die ("Please input required fields for your registration.");
            echo "Information Successfully Added!";
        }

?>